package com.sky.utils;



import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;


public class HuigeUtils {


    private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final Random RANDOM = new Random();

    public static String generateOrderNumber(int orderId) {
        // 生成前五位字母
        StringBuilder letters = new StringBuilder();
        for (int i = 0; i < 5; i++) {
            int index = RANDOM.nextInt(ALPHABET.length());
            letters.append(ALPHABET.charAt(index));
        }

        // 生成后十位数字
        String timestamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
        String randomDigits = String.format("%010d", orderId % 10000000000L);
        String digits = (timestamp + randomDigits).substring(0, 10);

        return letters.toString() + digits;
    }



    public static String generate11DigitNumber() {
        Random random = new Random();
        StringBuilder sb = new StringBuilder("1"); // 确保以1开头

        for (int i = 0; i < 10; i++) {
            sb.append(random.nextInt(10)); // 生成0-9的随机数字
        }

        return sb.toString();
    }

}
